from flask import jsonify
from app.api.v1 import bp
from app.models.marine_area import MarineArea
from app.services.analysis import calculate_comprehensive_score, analyze_industry_trends

@bp.route('/analysis/comprehensive-score/<int:area_id>', methods=['GET'])
def get_comprehensive_score(area_id):
    """
    获取指定海域的综合评分分析
    参数: area_id - 海域ID
    返回: 该海域的综合评分数据
    """
    area = MarineArea.query.get_or_404(area_id)
    score = calculate_comprehensive_score(area)
    return jsonify({'score': score})

@bp.route('/analysis/industry-trends/<int:area_id>', methods=['GET'])
def get_industry_trends(area_id):
    """
    获取指定海域的产业发展趋势
    参数: area_id - 海域ID
    返回: 该海域各产业的发展趋势数据
    """
    area = MarineArea.query.get_or_404(area_id)
    trends = analyze_industry_trends(area)
    return jsonify(trends) 